package com.sbtr.business.classify.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.classify.entity.AlgoCorpgenerate;
import com.sbtr.business.classify.dto.AlgoCorpgenerateDto;

import com.sbtr.business.classify.entity.AlgoTemplateCondition;
import com.sbtr.business.classify.service.AlgoCorpgenerateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.classify.mapper.AlgoCorpgenerateMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 算法生成 Service接口实现类
 *
 * @author dgl
 * @since  2023-09-08
 */
@Transactional
@Service
public class AlgoCorpgenerateServiceImpl extends ServiceImpl<AlgoCorpgenerateMapper,AlgoCorpgenerate> implements AlgoCorpgenerateService {

    @Autowired
    AlgoCorpgenerateMapper algoCorpgenerateMapper;

    @Override
    public PageDto<AlgoCorpgenerate> pageList(AlgoCorpgenerateDto algoCorpgenerateDto) {

        IPage<AlgoCorpgenerate> page = new Page<>();
        page.setSize(algoCorpgenerateDto.getPageSize());
        page.setCurrent(algoCorpgenerateDto.getPage());
        page = algoCorpgenerateMapper.selectPages(page, BeanUtil.beanToMap(algoCorpgenerateDto));
        PageDto<AlgoCorpgenerate> r = PageDtoUtils.getPageDtoByIPage(page, AlgoCorpgenerate.class);

        return r;
    }

    @Override
    public void cleanAndSaveBatch(AlgoTemplateCondition algoTemplateCondition) {


    }
}

